<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/5/10
 * Time: 14:19
 */
namespace Huangzikun\hawkeye_spider;

class PhpFpmClass extends BaseClass
{
    public $spiderInfo;
    public $apiAddress;
    public $uri;

    public function __construct($apiAddress)
    {
        parent::__construct($apiAddress);
    }

    public function grab()
    {
        $context = stream_context_create(array(
            'http' => array(
                'timeout' => 3 //超时时间，单位为秒
            )
        ));
        $fpmStatus = file_get_contents($this->uri, false, $context);
        if(empty($fpmStatus)){
            return ;
        }

        $this->spiderInfo = json_decode($fpmStatus);
    }
}